3.12.81 \(\int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx\) [1181]

Optimal. Leaf size=119 \[ \frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i (c-i d)^2 \, _2F_1\left (1,m;1+m;\frac {1}{2} (1+i \tan (e+f x))\right ) (a+i a \tan (e+f x))^m}{2 f m}-\frac {i d^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)} \]

[Out]

2*c*d*(a+I*a*tan(f*x+e))^m/f/m-1/2*I*(c-I*d)^2*hypergeom([1, m],[1+m],1/2+1/2*I*tan(f*x+e))*(a+I*a*tan(f*x+e))
^m/f/m-I*d^2*(a+I*a*tan(f*x+e))^(1+m)/a/f/(1+m)

________________________________________________________________________________________

Rubi [A]
time = 0.12, antiderivative size = 119, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3624, 3608, 3562, 70} \begin {gather*} -\frac {i (c-i d)^2 (a+i a \tan (e+f x))^m \, _2F_1\left (1,m;m+1;\frac {1}{2} (i \tan (e+f x)+1)\right )}{2 f m}+\frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i d^2 (a+i a \tan (e+f x))^{m+1}}{a f (m+1)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^2,x]

[Out]

(2*c*d*(a + I*a*Tan[e + f*x])^m)/(f*m) - ((I/2)*(c - I*d)^2*Hypergeometric2F1[1, m, 1 + m, (1 + I*Tan[e + f*x]
)/2]*(a + I*a*Tan[e + f*x])^m)/(f*m) - (I*d^2*(a + I*a*Tan[e + f*x])^(1 + m))/(a*f*(1 + m))

Rule 70

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(b*c - a*d)^n*((a + b*x)^(m + 1)/(b^(
n + 1)*(m + 1)))*Hypergeometric2F1[-n, m + 1, m + 2, (-d)*((a + b*x)/(b*c - a*d))], x] /; FreeQ[{a, b, c, d, m
}, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[m] && IntegerQ[n]

Rule 3562

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Dist[-b/d, Subst[Int[(a + x)^(n - 1)/(a - x), x]
, x, b*Tan[c + d*x]], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[a^2 + b^2, 0]

Rule 3608

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*(
(a + b*Tan[e + f*x])^m/(f*m)), x] + Dist[(b*c + a*d)/b, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c,
d, e, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]

Rule 3624

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e
 + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1] &&  !(EqQ[m, 2] && EqQ
[a, 0])

Rubi steps

\begin {align*} \int (a+i a \tan (e+f x))^m (c+d \tan (e+f x))^2 \, dx &=-\frac {i d^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)}+\int (a+i a \tan (e+f x))^m \left (c^2-d^2+2 c d \tan (e+f x)\right ) \, dx\\ &=\frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i d^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)}+(c-i d)^2 \int (a+i a \tan (e+f x))^m \, dx\\ &=\frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i d^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)}-\frac {\left (i a (c-i d)^2\right ) \text {Subst}\left (\int \frac {(a+x)^{-1+m}}{a-x} \, dx,x,i a \tan (e+f x)\right )}{f}\\ &=\frac {2 c d (a+i a \tan (e+f x))^m}{f m}-\frac {i (c-i d)^2 \, _2F_1\left (1,m;1+m;\frac {1}{2} (1+i \tan (e+f x))\right ) (a+i a \tan (e+f x))^m}{2 f m}-\frac {i d^2 (a+i a \tan (e+f x))^{1+m}}{a f (1+m)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(422\) vs. \(2(119)=238\).
time = 18.18, size = 422, normalized size = 3.55 \begin {gather*} \frac {2^{-1+m} e^{-2 i f m x} \left (e^{i f x}\right )^m \left (\frac {e^{i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^m \left (-\frac {i (c+i d)^2 e^{2 i f m x} \left (1+e^{2 i (e+f x)}\right )^m \, _2F_1\left (m,2+m;1+m;-e^{2 i (e+f x)}\right )}{m}-\frac {i e^{2 i e} \left (2 c^2 e^{2 i f (1+m) x} (2+m)+2 d^2 e^{2 i f (1+m) x} (2+m)+c^2 e^{2 i (e+f (2+m) x)} \left (1+e^{2 i (e+f x)}\right )^{1+m} (1+m) \, _2F_1\left (2+m,2+m;3+m;-e^{2 i (e+f x)}\right )-2 i c d e^{2 i (e+f (2+m) x)} \left (1+e^{2 i (e+f x)}\right )^{1+m} (1+m) \, _2F_1\left (2+m,2+m;3+m;-e^{2 i (e+f x)}\right )-d^2 e^{2 i (e+f (2+m) x)} \left (1+e^{2 i (e+f x)}\right )^{1+m} (1+m) \, _2F_1\left (2+m,2+m;3+m;-e^{2 i (e+f x)}\right )\right )}{\left (1+e^{2 i (e+f x)}\right ) (1+m) (2+m)}\right ) \sec ^{-m}(e+f x) (\cos (f x)+i \sin (f x))^{-m} (a+i a \tan (e+f x))^m}{f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^2,x]

[Out]

(2^(-1 + m)*(E^(I*f*x))^m*(E^(I*(e + f*x))/(1 + E^((2*I)*(e + f*x))))^m*(((-I)*(c + I*d)^2*E^((2*I)*f*m*x)*(1
+ E^((2*I)*(e + f*x)))^m*Hypergeometric2F1[m, 2 + m, 1 + m, -E^((2*I)*(e + f*x))])/m - (I*E^((2*I)*e)*(2*c^2*E
^((2*I)*f*(1 + m)*x)*(2 + m) + 2*d^2*E^((2*I)*f*(1 + m)*x)*(2 + m) + c^2*E^((2*I)*(e + f*(2 + m)*x))*(1 + E^((
2*I)*(e + f*x)))^(1 + m)*(1 + m)*Hypergeometric2F1[2 + m, 2 + m, 3 + m, -E^((2*I)*(e + f*x))] - (2*I)*c*d*E^((
2*I)*(e + f*(2 + m)*x))*(1 + E^((2*I)*(e + f*x)))^(1 + m)*(1 + m)*Hypergeometric2F1[2 + m, 2 + m, 3 + m, -E^((
2*I)*(e + f*x))] - d^2*E^((2*I)*(e + f*(2 + m)*x))*(1 + E^((2*I)*(e + f*x)))^(1 + m)*(1 + m)*Hypergeometric2F1
[2 + m, 2 + m, 3 + m, -E^((2*I)*(e + f*x))]))/((1 + E^((2*I)*(e + f*x)))*(1 + m)*(2 + m)))*(a + I*a*Tan[e + f*
x])^m)/(E^((2*I)*f*m*x)*f*Sec[e + f*x]^m*(Cos[f*x] + I*Sin[f*x])^m)

________________________________________________________________________________________

Maple [F]
time = 3.01, size = 0, normalized size = 0.00 \[\int \left (a +i a \tan \left (f x +e \right )\right )^{m} \left (c +d \tan \left (f x +e \right )\right )^{2}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^m*(c+d*tan(f*x+e))^2,x)

[Out]

int((a+I*a*tan(f*x+e))^m*(c+d*tan(f*x+e))^2,x)

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^m*(c+d*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

integrate((d*tan(f*x + e) + c)^2*(I*a*tan(f*x + e) + a)^m, x)

________________________________________________________________________________________

Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^m*(c+d*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

integral((c^2 + 2*I*c*d - d^2 + (c^2 - 2*I*c*d - d^2)*e^(4*I*f*x + 4*I*e) + 2*(c^2 + d^2)*e^(2*I*f*x + 2*I*e))
*(2*a*e^(2*I*f*x + 2*I*e)/(e^(2*I*f*x + 2*I*e) + 1))^m/(e^(4*I*f*x + 4*I*e) + 2*e^(2*I*f*x + 2*I*e) + 1), x)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (i a \left (\tan {\left (e + f x \right )} - i\right )\right )^{m} \left (c + d \tan {\left (e + f x \right )}\right )^{2}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**m*(c+d*tan(f*x+e))**2,x)

[Out]

Integral((I*a*(tan(e + f*x) - I))**m*(c + d*tan(e + f*x))**2, x)

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^m*(c+d*tan(f*x+e))^2,x, algorithm="giac")

[Out]

integrate((d*tan(f*x + e) + c)^2*(I*a*tan(f*x + e) + a)^m, x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^m\,{\left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )}^2 \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a*tan(e + f*x)*1i)^m*(c + d*tan(e + f*x))^2,x)

[Out]

int((a + a*tan(e + f*x)*1i)^m*(c + d*tan(e + f*x))^2, x)

________________________________________________________________________________________